package com.nbsaas.boot.data.rest.convert;

import com.nbsaas.boot.data.data.entity.QueryTemplateHistory;
import com.nbsaas.boot.data.api.domain.response.QueryTemplateHistoryResponse;

import com.nbsaas.boot.utils.BeanDataUtils;
import com.nbsaas.boot.rest.api.Converter;
/**
* sql历史-实体对象转化成响应对象
*/

public class QueryTemplateHistoryResponseConvert  implements Converter<QueryTemplateHistoryResponse,QueryTemplateHistory> {

    @Override
    public QueryTemplateHistoryResponse convert(QueryTemplateHistory source) {
        QueryTemplateHistoryResponse  result = new  QueryTemplateHistoryResponse();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getQueryTemplate()!=null){
                        result.setQueryTemplate(source.getQueryTemplate().getId());
                    }
                    if(source.getCreator()!=null){
                        result.setCreator(source.getCreator().getId());
                    }
        return result;
    }

}

